package com.gitee.huanminabc.demo.spring.monitor.listener;

import com.gitee.huanminabc.demo.spring.monitor.event.DemoEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * @Author huanmin
 * @Date 2024/6/5 下午6:26
 */
@Component
//@Order(1)  //值越小，优先级越高
//@Async  //异步监听 ,尽量自定义线程池
public class DemoListener implements ApplicationListener<DemoEvent> {
    @Override
    public void onApplicationEvent(DemoEvent event) {
        System.out.println("监听到事件:" + event.getSource());
    }
}
